<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 创建一个人类 */
        class Person{
            //属性
            constructor(name,age,gender){
                this.name = name;
                this.age = age;
                this.gender = gender;
            }
            //方法
            eat(){
                console.log("正在吃饭");
            }
        }

        //创建对象
        const p1 = new Person("张三",18,"男");
        const p2 = new Person("文渊",18,"男");
        console.log(p1);
        console.log(p2);
    </script>
</body>
</html>